Repository navigation
Conversation
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent (self_reported, Gemini, Google)
动机 / Motivation
面向的问题对象与触发任务:需要自动清理已完成 Goal 工作树并审计执行结果的运维者与代理宿主。
改动前后场景对照:改动前:停止、注销或归档 Goal 时不触发任何外部清理命令,且配置中心不存在该项;改动后:仅直接调用 Python 函数 run_goal_closeout 可执行命令并记账,但 CLI 与 Dashboard 已可见 goal_closeout 命名空间,而 stop、retire 与 archive 仍完全不调用它。
当前可观测结果与非目标范围:目前仅单元测试直接调用 run_goal_closeout 可验证 payload、超时与失败返回;任意生产终态命令均无行为变化,且 machine-config 注册表与 HTTP 目录已发生变化。非目标边界:不包含内置 git worktree 清理逻辑(proposal 2)、worktree 状态发现命令(proposal 3)以及在本次提交内完成终态入口接线或 Dashboard 可视化编辑器。
放任现状不修会持续累积数十 GB 孤立工作树,但当前 PR 以正式非 Draft 状态提交了一个“配置已暴露、调用方为零、安全与静态检查均有缺失”的半成品,不仅无法交付终态自动清理,反而破坏既有机器配置目录契约。
改动思路 / Approach
该实现将尚未接线的执行器提前注册进公开 machine_configuration 目录,既破坏现有配置契约又通过未鉴权 HTTP 接口开放任意命令写入,且重复实现了 process_runtime.py 与 paths.py 的既有能力。
当前边界判断:必须先收回或隔离公开 HTTP 命令写入面、复用既有进程树与 goal_id 校验所有者并接通至少真实终态入口或退回 Draft,当前边界不具备合并条件。
按代码路径追踪,PR 在 loopx/capabilities/goal_closeout/machine_defaults.py 定义 goal_closeout 命名空间,通过 loopx/capabilities/machine_configuration/builtins.py 注册进全局配置注册表;执行层 loopx/capabilities/goal_closeout/hooks.py 通过 read_machine_configuration 读取配置,启动 subprocess.Popen(..., start_new_session=True) 传入 JSON stdin 并写 closeout-ledger.jsonl。与仓库既有方案相比,loopx/extensions/process_runtime.py 已经提供了带跨平台进程树清理和实时字节上限的 run_capped_process / terminate_process_tree,loopx/paths.py 也提供了防穿越的 validate_goal_id_path_segment,本 PR 均未复用;同时本 PR 直接将任意命令 command: list[str] 暴露到了无认证 loopback HTTP 的 machine_configuration 读写面,但未在 configuration_ui.py 注册对应界面字段,也未在 set_goal_activation_state、retire_global_registry_goals 或 archive_runtime_goal 中接入调用。
具体改动 / Changes
本次共涉及 5 个文件(+433 / -0):新增 loopx/capabilities/goal_closeout/__init__.py、machine_defaults.py、hooks.py 与 tests/capabilities/test_goal_closeout_hook.py,修改 loopx/capabilities/machine_configuration/builtins.py。
对照规格 Issue #8918(基准版本 issue-8918-opened-by-cuipengcx90-0-comments,proposal 1)的逐项验收如下:
| Criterion | 要求 | 当前 Head 状态 | 依据 / 缺口 |
|---|---|---|---|
C-1 |
配置声明 closeout 命令与超时 | not_met |
允许经无认证 loopback HTTP /apply 写入任意可执行命令并回显;未补齐 configuration_ui.py 与既有目录测试 |
C-2 |
stdin 传递有界 JSON 负载(loopx_goal_closeout_v1) |
implemented |
hooks.py::run_goal_closeout + 单元测试 |
C-3 |
有界超时且失败不阻塞主命令 | not_met |
未复用 process_runtime.py,Windows 无法清理后代进程,临时文件无运行期上限且 cwd=repo 锁死待删工作树 |
C-4 |
每次调用记入关闭账本 | not_met |
goal_id 未校验可路径穿越、FileNotFoundError 跳入 internal_error 漏记账、archive 后写盘会重建 goals/<id> 目录 |
C-5 |
stop / retire / archive 后自动触发 | not_met |
全仓搜索显示 0 处生产调用点 |
关键代码讲解
loopx/capabilities/goal_closeout/hooks.py#L95(run_goal_closeout):读取goal_closeout配置并以subprocess.Popen执行,捕获超时与异常后通过_write_ledger追加账本。问题在于将Path(repo).is_dir()与Popen放在同一外层try块中,缺失二进制触发FileNotFoundError时直接落入internal_error而不写入账本,且cwd=repo会在待删除 worktree 内持有目录句柄。loopx/capabilities/goal_closeout/hooks.py#L35(goal_closeout_ledger_path):直接返回runtime_root / "goals" / goal_id / "closeout-ledger.jsonl",既未调用validate_goal_id_path_segment防穿越,也会在archive_runtime_goal搬走goals/<id>后因mkdir(parents=True)重新造出空目录。loopx/capabilities/goal_closeout/hooks.py#L30(_Capture.text) &#L59(_terminate):前者因handle: Any导致mypy报no-any-return且不限制进程运行期写入临时文件的总大小;后者仅用os.killpg清理进程组,在 Windows 回退到单进程process.kill()。loopx/capabilities/goal_closeout/machine_defaults.py#L50(goal_closeout_machine_configuration_namespace):以project_public=dict、apply_public_update=dict注册了包含任意command: list[str]的命名空间,使得公开 HTTP API 既可写也可回显本机可执行路径与脚本参数。loopx/capabilities/machine_configuration/builtins.py#L82(build_builtin_machine_configuration_registry):延迟注册了goal_closeout,立即改变了默认可用命名空间集合与/api/chat/machine-configuration目录输出,破坏了 3 项既有测试。
对主干的风险 / Risks
- [P0] 暴露无生产调用方的配置面且破坏 3 项既有契约测试:在
builtins.py注册goal_closeout后,未配置状态下也会改变默认目录,实测导致test_builtin_catalog_lists_every_owner_in_namespace_order、test_inspection_lists_registered_namespaces_without_local_refs、test_machine_catalog_discovers_goal_features_without_granting_machine_writes全部FAIL(207 passed, 3 failed, 41 skipped)。同时操作者在配置后不会看到stop/retire/archive有任何效果,违反AGENTS.md关于不得只交付未接入真实触发点空壳的要求。最小修复:接通set_goal_activation_state、retire_global_registry_goals、archive_runtime_goal并更新契约测试,或在完成前退回 Draft 并移除builtins.py注册。 - [P0] 无认证 loopback HTTP 接口允许写入任意操作系统命令:
ChatRequestHandler._require_loopback_origin允许无Origin头的本地请求与同源浏览器请求调用POST /api/chat/machine-configuration/preview与/apply。反事实测试实测直接通过 HTTP 成功持久化了['/bin/sh', '-c', 'id > /tmp/pwned'](HTTP 201 -> 200applied),并在GET响应中回显。最小修复:禁止经由公开 HTTPapply_public_update写入任意command(或仅限受保护的本地 CLI /0600配置文件 / 显式扩展清单注册),并对project_public脱敏本机路径。 - [P1]
goal_id路径穿越与 archive 幽灵目录复活:反事实测试传入goal_id="../../evil",run_goal_closeout未拒绝而是返回ledger_recorded=True并写入越界路径;此外archive_runtime_goal移除runtime_root/goals/<id>后若写同位置账本会重建空目录,被loopx/history.py再次识别为运行时 Goal。最小修复:使用validate_goal_id_path_segment(goal_id),移除cwd=repo,并将账本改为不会在归档后复活goals/<id>的路径。 - [P1]
mypy失败、canary premerge失败及跨平台/漏记账缺陷:mypy对 5 个文件实测FAIL(hooks.py:32: error: Returning Any from function declared to return "str" [no-any-return]);loopx canary premerge --tier quick --from-git-diff --git-diff-base 5cfd6ae7d571f2f97da40982db23f76540723c89实测FAIL(git diff --check报hooks.py:218: new blank line at EOF.)。此外反事实测试确认不存在的二进制文件会落入internal_error且ledger_recorded=False。最小修复:修复类型注解与 EOF 空行,复用loopx/extensions/process_runtime.py并把启动失败记入账本。
我的整体评价 / Verdict
基于当前精确 head 7423d748adbfd7cee0c01ff03e314ed82bc5a8ee 的实测验证,本次评审结论为请求修改(REQUEST_CHANGES)。
- 长程与用户体验影响:
long_horizon与user_experience均判定为regression(visual_review为not_applicable:本 PR 未改动前端源码,仅核对了configuration_ui.py与 Settings 界面回退行为)。在未接线终态调用点且未收紧 HTTP 写入边界的情况下向builtins.py注册该命名空间,会同时造成配置假象与安全面扩大。 - 本地验证摘要:
pytest tests/capabilities/test_goal_closeout_hook.py:PASS(4 passed,仅测孤立函数)pytest(机器配置/API/分布/语义/边界/ratchet 合集):FAIL(207 passed, 3 failed, 41 skipped;核心分布安装态因未设LOOPX_CORE_TEST_PYTHON跳过)pytest tests/capabilities/test_capability_configuration_ui.py tests/test_configuration_backup.py:PASS(82 passed)ruff check与node --test personal-workspace-contract.test.mjs:PASSmypy(5 个改动文件):FAIL(hooks.py:32 no-any-return)loopx canary premerge --tier quick:FAIL(hooks.py:218: new blank line at EOF.;另control-plane-maintainability-ratchet-smoke.py有 2 条基线无关 advisory 告警)- 反事实验证(
../../evil穿越、缺失二进制漏记账、无认证 HTTP 写 shell 命令):FAIL(均已实测复现) - 远端 CI:
UNVERIFIED / not_applicable(遵循wait_for_ci=false策略,未查询或等待远端 CI)
- 语义词表结论:
semantic_alignment判定为not_applicable——PR 未改动loopx/semantics/vocabulary_v0.json中任何跨运行时词表,hooks.py新增的状态字符串为局部结果字段,且examples/semantic-vocabulary-drift-smoke.py(29/29 词表)PASS;不过hooks.py的trigger与terminal_reason建议后续收敛为显式Literal或StrEnum。 - 残留风险:Windows 进程树清理与
loopx-core独立 wheel 安装态尚未在本机验证。请作者修复上述 4 项阻塞缺陷(接入终态入口或撤回builtins.py暴露、收敛 HTTP 命令写入安全边界、校验goal_id并解决 archive 冲突、修复mypy/EOF 空行并复用process_runtime.py)后重新提交复审。
English verdict: REQUEST_CHANGES on 9065@7423d748adbfd7cee0c01ff03e314ed82bc5a8ee due to unwired terminal lifecycle callers exposing a dead config namespace (breaking 3 contract tests), unauthenticated loopback HTTP command registration in machine_configuration, unvalidated goal_id path traversal, missing ledger recording on spawn errors, mypy failure, and canary premerge diff check failure.
|
已在
执行器从 验证:closeout/archive/registry/process-runtime 117 passed、1 skipped;goal activation 55 passed;架构套件在基线与本头均为 1798 passed,98 failed(94 项同为本机缺少 npm dev dependencies)。canary quick 的六项直接检查通过;semantic-vocabulary 与 quota-plan canary 在基线同样因本机 npm/TS 环境失败。 |
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent (self_reported, Gemini, Google)
动机 / Motivation
面向的问题对象与触发任务:需要自动回收已完成 Goal 工作树并保留执行审计记录的运维者与代理宿主。
改动前后场景对照:改动前:执行 goal-lifecycle stop、retire-global-goal 或 archive-runtime 仅更新注册表或移动目录,不触发任何本机清理命令,也不写关闭账本;改动后:若本机通过 CLI 配置了 goal_closeout.command,三条终态路径在事务提交且释放全部规范锁之后,自动以受限子进程执行该命令、通过 stdin 传入 loopx_goal_closeout_v1 JSON 负载并将结果追加到 closeout-ledger.jsonl。
当前可观测结果与非目标边界:当前可观测结果:配置 goal_closeout 后,stop(仅首次切换至 stopped,重复调用幂等不重触发)、retire 与 archive 均在提交并释放锁后触发命令并记账,超时/失败/缺失二进制绝不阻塞或改写主命令结果;未配置时三条终态命令保持零副作用且不生成账本;loopback HTTP 接口无法写入或读取本机 command。非目标边界:不包含内置 git worktree 自动删除逻辑(proposal 2)、worktree 状态发现命令(proposal 3)、经由无认证 HTTP 注册可执行命令,以及在 Dashboard 中新增本地命令路径编辑框。
对上一轮审查 #5968911212(head 7423d748ad)提出的 4 项阻塞缺陷,本轮精确头 f92547362cfd10dce59e8912dfe067776064b028 已逐项完成修复并闭环了 archive 锁边界问题,交付了一个完整、可逆且默认关闭的终态钩子切片。
改动思路 / Approach
架构边界与所有权拆分合理:配置契约留在 machine_configuration 注册表并隔离 command 为本机 CLI 私有,子进程执行下沉至 loopx/lifecycle/goal_closeout.py 并复用 process_runtime 进程树清理与 paths 路径段校验,终态调用方在提交并释放规范锁之后以尽力而为方式触发,既未引入跨层依赖也未创建重复控制面决策所有者。
当前 PR 边界为 Issue #8918 方案一的完整可逆交付:覆盖 machine_configuration 命名空间(CLI 写 command、Dashboard 仅调 timeout_seconds)、stop/retire/archive 终态后锁外调用、以及 closeout-ledger.jsonl 账本;不包含内置 git worktree 自动删除与 worktree 状态扫描命令。
关于 TypeScript-First 与模块落点:machine_configuration 注册表、三个终态入口(activation_service.py、global_registry.py、runtime.py)及受限子进程调度(process_runtime.py)均属 Python 运行时所有者,将 run_goal_closeout 置于 loopx/lifecycle/goal_closeout.py 使 loopx/control_plane 无需反向依赖 loopx.capabilities(test_control_plane_import_boundaries.py 全部通过)。
| 路径 / 阶段 | 7423d74(旧) | f925473(当前 Head) |
|---|---|---|
| 终态入口接线 | 0 处生产调用点 | stop / retire / archive 均在提交且释放全部规范锁后调用 |
| HTTP 安全边界 | 允许经 loopback HTTP 写入任意 command |
local_only_fields 拒绝 HTTP 写 command(400),公开投影脱敏为 configured |
| 路径与账本 | 未校验 goal_id、cwd=repo、归档重建 goals/<id> |
validate_goal_id_path_segment、cwd=None、归档写目标目录、retire 回退 closeout/<id> |
| 进程治理 | 自写 Popen/临时文件、mypy 与 EOF 失败 |
复用 run_capped_process 并暴露 stderr,启动失败记为 launch_error |
具体改动 / Changes
本次基于合并基线 9dbe0f2a56077ed133d5bb3796bc2fa6df7d75a2 至精确 head f92547362cfd10dce59e8912dfe067776064b028 共改动 16 个文件(+1213 / -3),其中生产代码 12 个文件(+535 / -1),测试 4 个文件(+678 / -2)。
对照规格 Issue #8918(基准版本 issue-8918-opened-by-cuipengcx90-0-comments,proposal 1)的逐项验收如下:
| Criterion | 要求 | 当前 Head 状态 | 依据 / 验证 |
|---|---|---|---|
C-1 |
配置声明 closeout 命令与超时且安全隔离 | implemented |
goal_closeout/machine_defaults.py + contract.py + configuration_ui.py;HTTP 写 command 实测返回 400 |
C-2 |
stdin 传递有界 JSON 负载(loopx_goal_closeout_v1) |
implemented |
loopx/lifecycle/goal_closeout.py::run_goal_closeout + 单元测试与 SQLite CLI 探针 |
C-3 |
有限超时、受限输出与失败不阻塞主命令 | implemented |
复用 process_runtime.py::run_capped_process(cwd=None);实测 exit 42、1s 超时与缺失二进制均不阻塞主命令 |
C-4 |
每次调用记入只追加账本且防越界/不复活目录 | implemented |
validate_goal_id_path_segment + exclusive_file_lock;archive 写目标目录、retire 回退 closeout/<id> |
C-5 |
stop / retire / archive 提交并释放锁后触发 |
implemented |
activation_service.py、global_registry.py、runtime.py;stop 幂等重跑不重触发,archive 锁探针 FREE/FREE |
关键代码讲解
loopx/capabilities/goal_closeout/machine_defaults.py(goal_closeout_machine_configuration_namespace):定义loopx_goal_closeout_configuration_v0,通过local_only_fields=frozenset({"command"})将command锁定为本机 CLI 专属字段;_public_goal_closeout_configuration仅向 Dashboard/API 暴露configured布尔值与timeout_seconds(1–600),_apply_goal_closeout_public_update允许在线调整超时并原样保留已配置的command。loopx/capabilities/machine_configuration/contract.py(merge_machine_configuration_namespace):新增allow_local_only: bool = False默认保护。MachineConfigurationRequestMixin(loopback HTTP)默认拒绝任何命中local_only_fields的键并落回 HTTP 400;machine_configuration/cli.py在preview/apply时显式传入allow_local_only=True。loopx/lifecycle/goal_closeout.py(run_goal_closeout):入口先调用validate_goal_id_path_segment防路径穿越,再按namespace_ids=("goal_closeout",)惰性读取配置;未配置时零盘写直接返回not_configured。启用时经run_capped_process(..., cwd=None)启动进程组并截断捕获 8 KiBstdout/stderr,所有启动、超时、超输出与写账本异常均转化为结构化状态并写回closeout-ledger.jsonl,绝不向上抛错。loopx/control_plane/goals/activation_service.py(set_goal_activation_state/_stop_closeout_payload):在project_registry_transaction锁块外、仅当execute and target_state is GoalActivationState.STOPPED and changed and payload.get("ok") and payload.get("written")时调用一次钩子;已处于STOPPED状态的幂等重试changed=False,不会重复触发。loopx/runtime.py(archive_runtime_goal) &loopx/global_registry.py(retire_global_registry_goals):retire_global_registry_goals在释放维护锁与全局注册表锁后遍历retired_goals,当goals/<id>不存在时改写runtime/closeout/<id>;archive_runtime_goal(a00dd3763a)在 4 重规范锁内完成移动与元数据快照,退出ExitStack释放全部锁后再执行run_goal_closeout(..., ledger_dir=destination),实测子进程检查运行期产物锁与注册表锁均为FREE。
对主干的风险 / Risks
未发现阻塞主干或破坏兼容性的 P0/P1 缺陷;与上一轮 #5968911212 相比,3 项破坏的契约测试已全部通过,HTTP 任意命令写入、goal_id 越界、cwd=repo 锁目录、缺失二进制漏记账、mypy 报错及 EOF 空行均已修复。
- 禁用态隔离与基线对等(
default_off_isolation):基于基线9dbe0f2a56与当前 headf92547362c的同构对照执行显示,未配置goal_closeout时stop/retire/archive均正常提交(ok=true),不产生进程或账本副作用,仅在配置目录新增goal_closeout条目与返回体附加status='not_configured'状态对象。 - 两项非阻塞
P3观察:loopx/runtime.py::archive_runtime_goal在加锁前从registry提取archive_goal元数据,而非从锁内locked_registry再次取值;虽有locked_source_registry_paths与_archive_source_goal_refs预检保护,后续可顺手改读locked_registry以保持单快照一致。apps/presentation/dashboard/src/features/personal-workspace/capability-localization.ts尚未补充goal_closeout的中文翻译键,界面目前安全回退展示后端英文标题与说明;此外 Dashboard 通用的移除按钮可删除整个goal_closeout命名空间,但不构成命令注入风险。
我的整体评价 / Verdict
基于对精确 head f92547362cfd10dce59e8912dfe067776064b028 的独立测试、基线对照与真实 SQLite/CLI/HTTP 端到端探针验证,当前评审结论为建议批准(APPROVE)。
- 长程与用户体验影响:
long_horizon与user_experience均判定为improved(visual_review为not_applicable:本 PR 未修改前端代码,已核对configuration_ui.py、machine-configuration-settings.tsx与capability-localization.ts的timeout_seconds表单消费及回退路径)。钩子严格在提交且释锁后执行,失败不阻塞终态,且通过本机 CLI 与 loopback HTTP 权限切分降低了配置风险与运维负担。 - 本地验证摘要(
wait_for_ci=false,未查询或等待远端 GitHub Actions CI):pytest(closeout / 终端钩子 / machine-config API & 契约 / UI 编辑器 / 备份 / goal activation / runtime archive / global registry / process_runtime 共 11 个测试集):PASS(305 passed, 1 skipped——Windows 专属用例在 macOS 跳过)pytest tests/test_runtime_archive_concurrency.py -q:PASS(9 passed)pytest tests/architecture/test_control_plane_import_boundaries.py tests/architecture/test_goal_id_path_segment_owner.py -q:PASS(47 passed)pytest tests/architecture -q(带完整node_modules):1894 passed, 2 failed——两项失败(test_retrodiction_holds_its_frozen_baseline在E07报11/15 < 12/15,以及test_direct_project_registry_loaders_have_source_session_denial报未改动文件loopx/presentation/goal_storage_api.py)已在不可变合并基线9dbe0f2a56上复现出完全一致的失败签名(pre_existing_unrelated)- 真实 SQLite/CLI/HTTP 端到端隔离探针:
PASS(覆盖 3 个 SQLite Goal:goal_closeout禁用态、启用态stop→幂等重复stop→retire→archive、缺失goals/<id>目录回退closeout/<id>、exit 42、1s 超时、缺失二进制launch_error、../escape拒绝以及真实ChatHTTPServer拦截command注入返回 400) - 静态与契约检查:
ruff check全通过;mypy --follow-imports=silent(12 个改动文件)0 报错;git diff --check 9dbe0f2a56..HEAD通过;Dashboardtsc --noEmit与node --test personal-workspace-contract.test.mjs(4/4)通过 loopx check --scan-path ...:PASS(16 个改动文件公开边界扫描 0 error / 0 warning)loopx canary premerge --tier quick --from-git-diff --git-diff-base 9dbe0f2a56077ed133d5bb3796bc2fa6df7d75a2:PASS(ok=true,merge_gate_passed=true;direct checks 4/4、semantic-vocabulary-drift-smoke.py、quota-plan-smoke.py均通过;control-plane-maintainability-ratchet-smoke.py仅有 1 条基线已存在的interaction_contract.py::_admitted_interaction_next_cli_actionsadvisory 告警)
- 语义词表 conclusions /
semantic_alignment:判定为not_applicable——PR 未修改loopx/semantics/vocabulary_v0.json中任何跨运行时词表,新增字段均为goal_closeout模块局部值且semantic-vocabulary-drift-smoke.py通过。 - 残留风险:Windows 平台进程树终止(
CREATE_NEW_PROCESS_GROUP+taskkill)与独立安装态loopx-corewheel 尚未在当前 macOS 宿主验证;远端 CI 按wait_for_ci=false策略未查询。批准本评审本身不构成合并授权,是否合并及基线同步由维护者依据仓库策略决定。
English verdict: APPROVE on 9065@f92547362cfd10dce59e8912dfe067776064b028 — all prior blockers from review 5968911212 and the archive lock-release boundary are resolved and verified via 305 focused tests, static/canary checks, and isolated SQLite CLI/HTTP probes.
|
This pull request has merge conflicts with Choose the remote for the base repository, not an out-of-date fork. git fetch upstream
git rebase upstream/main
# Resolve each conflict, git add the resolved files, then git rebase --continue.
git push --force-with-lease origin HEADFor a same-repository clone whose Keep the DCO |
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent · gpt-6.2-sol · OpenAI (runtime_reported, max)
Reviewed head f92547362cfd10dce59e8912dfe067776064b028
-
[P2] 保留已经提交并确认的停止结果。两份注册表都确认停止后,钩子的参数准备仍会重新读取来源。读失败时 CLI 退出 1 并返回
written=false。建议利用已确认的快照准备参数,并把准备失败纳入钩子诊断。停止后的注册表读取 -
[P2] 用注册表解析后的绝对路径填充钩子载荷。使用已有的相对
state_file注册时,停止、退役和归档的外部状态文件分支都把相对值传给子进程。请复用现有路径解析,归档后按文件实际位置生成路径。停止 · 退役 · 归档
动机 / Motivation
用独立 Git worktree 执行 Goal 的操作者,在停止、退役或归档之后需要知道何时可以开始整理工作目录。
过去归档只移动 LoopX 运行目录,操作者还要逐个对照 Goal 和工作目录,或为每种宿主维护一套清理入口。这个 PR 允许操作者设置一次本机命令,让三种操作在提交后把 Goal 和路径交给同一个程序,并留下一条调用记录。
用真实 CLI 验证了三条成功路径。现有注册的相对状态路径会让消费方拿不到所需的绝对路径,停止后读取注册表的异常还会掩盖已经提交的结果。
范围限于提供终态通知和调用记录。目录清理规则和通用扩展触发器属于 Issue 中的其他提案。
改动思路 / Approach
三个生命周期入口各自保留已有的权限检查、锁和提交顺序。已提交的终态才产生可选通知。执行器从本机配置读命令,使用已有进程约束处理退出、超时与输出,并把此次执行追加到本机记录。 终态钩子实现 · 通用进程执行器
把机器配置当作一次注册,将命令放在终态确认之后,复用通用进程边界。提交后的通知仍要隔离路径解析和读取异常。 本 PR 可在既有状态路径解析和终态写回的边界内补齐,不需要新增运行时或扩展调度。 项目注册的状态路径已有明确规则,退役资格检查也已解析相对值。这两处规则能直接支撑载荷中的路径语义。 项目注册路径 · 全局路径解析
具体改动 / Changes
本次改动涉及 16 个文件,+1213 / −3。主要新增集中在机器配置、三个提交后的调用点、钩子执行和验证。验收依据为 Issue #8918 的 Proposal 1,读到的正文版本为 sha256:aa2fd7a4818b17cf5627f14fd7b557706548e16eb1297c3b90b3308e70e6ba3d。 Issue #8918
terminal-triggers。停止、退役和运行目录归档成功提交后触发一次。 已验证。set_goal_activation_state、retire_global_registry_goals、archive_runtime_goal三条真实 CLI 执行及无写入预览对照。stdin-payload。向标准输入提供loopx_goal_closeout_v1及 Goal、绝对 worktree 和状态路径、终态原因和 runtime root。 未满足。相对state_file从三个入口原样进入载荷。 通过各入口现有注册表路径所有者生成绝对路径。timeout。执行有有限超时。 已验证。run_goal_closeout与run_capped_process本地 1 秒超时、普通命令退出及启动失败用例。best-effort。钩子失败时触发命令仍报告实际完成的终态。 未满足。停止后准备参数的注册表读取失败会覆盖已写入结果。 将准备异常与执行异常放在同一 best-effort 边界,保留原有终态回执。ledger。记录已执行的调用。 已验证。_write_ledger三个 CLI 的合成 ledger 行及归档后位置读回。
关键代码讲解
-
merge_machine_configuration_namespace通过已有机器配置事务写入。CLI 可设置命令,Dashboard 表单可设置超时;配置投影只返回是否已有命令及超时值。 命名空间更新 · 编辑器描述 -
set_goal_activation_state先完成注册表写回和验证,再根据本次是否确实进入停止状态调用钩子。相同状态的重复停止不产生第二条调用记录。 停止触发门 -
retire_global_registry_goals从实际移除的记录取信息,保留原有备份与资格检查,释放维护锁后逐项通知。 退役后通知 -
archive_runtime_goal在原锁内移动运行目录,释放锁后执行。随目录移动的状态文件与留在项目中的状态文件需要各自准确定位。 归档与位置选择 -
run_goal_closeout复用进程执行器处理退出、超时和诊断输出,给尝试过的调用追加 ledger。未设置命令时没有子进程或账本记录。 执行与记录 · 执行器用例
对主干的风险 / Risks
用同一合成状态分别运行基线 9dbe0f2a56077ed133d5bb3796bc2fa6df7d75a2 和当前 head,检查进程退出、终态读回和账本结果。
| 验证条件 | 实际结果 |
|---|---|
| 缺省配置,正常执行三种操作 | 基线与 head 都完成相同终态,预览无调用;head 增加可选的钩子结果字段。 |
| 成功读回后注入来源注册表读取错误 | 基线退出 0。head 退出 1,报告 written=false,持久化状态已经停止。 |
| 在项目之外调用,用相对路径登记状态 | 三条命令完成终态,接收方因路径不符合契约退出,账本各留一条失败。绝对路径对照组各留一条成功。 |
两个失败都可以在一次小修后重跑。停止保留原回执并单独记录钩子准备错误,路径修复复用注册表解析。建议回归用例从另一个目录走真实 CLI,并同时检查返回值、注册表和账本。
本地定向测试 223 项通过,1 项 Windows 用例跳过。标准 premerge 通过,有一条与本 diff 无关的既有可维护性 advisory。已观察到目标分支存在测试文件冲突,合并前需更新分支并验证新 head。
语义与 CI 对齐
终态成功的判定仍由写入和读回构成。可选钩子仅消费该结果;当前 head 的准备异常改变了可观察行为。新版本化载荷与账本记录作为生命周期接口扩展,解决路径和返回值契约后,用同一文件系统 fixture 重跑三条命令。GitHub CI 未纳入本次验证。
我的整体评价 / Verdict
REQUEST_CHANGES。长期运行中,停止已提交却显示失败会引发多余的重试。用户操作方面,设置页的超时预览和应用已在实际 Chat HTTP 后端读回,过期预览被拒绝,重新加载并应用后保留了本机命令。三个终态入口仍需把报告的结果与持久状态、路径对齐。
在同一源码构建的能力中心,超时输入和变更按钮集中在一个卡片。桌面默认视图显示配置来源,是否有命令要展开原始 JSON 才看得到。窄屏保留了可读的超时值,展开后能读到配置状态。 浏览器覆盖本地构建和合成机器配置。正式打包安装、Lark 界面及更长的真实目录数据保留为未验证。
范围和共用进程执行器都适合这项需求。当前最有价值的收敛是共用已有路径规则,并保持通知失败的诊断留在钩子结果里。修复后请用相同 fixture 验证缺省关闭、相对路径、提交后读失败和正常重试。
English verdict: REQUEST_CHANGES. At f92547362cfd10dce59e8912dfe067776064b028, the stop hook can mask a committed stop after a registry read error, and supported relative registrations reach the hook without the required absolute state path. Local CLI, browser settings, and focused tests were run.
| from ...lifecycle.goal_closeout import run_goal_closeout | ||
|
|
||
| closeout_runtime_root = resolve_runtime_root( | ||
| load_registry(source_registry), |
There was a problem hiding this comment.
[P2] 保留已提交的停止回执
这个 load_registry 发生在两份注册表都读回 stopped 之后。用相同 fixture 只让这次读失败,基线退出 0,当前 head 退出 1 并报告 written=false,但写入已经完成。空配置也会进入这里。请从已验证的快照取所需参数,并把剩余准备异常记入钩子诊断。回归用例应在真实 goal-lifecycle --operation stop --execute 上同时断言退出码、written 和两份持久状态。
| runtime_root=closeout_runtime_root, | ||
| goal_id=goal_id, | ||
| repo=str(closeout_goal.get("repo")) if closeout_goal.get("repo") else None, | ||
| state_file=str(state_file), |
There was a problem hiding this comment.
[P2] 使用注册表解析后的绝对状态路径
相对 state_file 是已有的合法注册值。从独立目录执行真实 CLI 时,接收器收到原始相对路径,因不符合 Issue #8918 的载荷约定而失败。停止、退役和归档外部状态文件的分支都复现了。请复用已有注册路径规则,并在归档后按文件是否移动生成目标路径。用等义的相对/绝对注册各跑三条公开入口,核对接收路径和 ledger。
f925473 to
10df7a2
Compare
|
Replying to review 5979637102. Both P2 findings are fixed at
Verification: 126 tests pass — |
|
CI note on
The same three PR-only jobs ( |
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent · Gemini · Google DeepMind · self_reported
基于当前精确 head 10df7a231c079576a034c5dd8f594b0e8255bb57 的静态检查、定向测试集与隔离 CLI/SQLite/File 反事实探针,本次复审结论为请求修改(REQUEST_CHANGES)。作者已修复上一轮(review 5979637102)中 stop 提交后重读注册表覆盖已写入回执的问题,并修复了项目注册表路由下的相对 state_file 解析;但本次新提交在 activation_service.py 引入了 mypy 类型回归,且在全局注册表路由的 archive-runtime(标准 bootstrap 目录布局)与孤立全局注册表 stop 回退路径下,相对 state_file 仍被解析到运行根或家目录而非项目目录。
动机 / Motivation
需要在 Goal 结束时自动回收独立 Git worktree 并审计清理执行的运维者与代理宿主,在执行 goal-lifecycle --operation stop、retire-global-goal 或 archive-runtime 时会遇到该问题。
改动前:上述三条终态命令仅更新注册表或迁移运行目录,不会调用任何由 LoopX 统一管理的外部清理钩子,也不会记录清理尝试是否成功,运维者只能在各宿主分别挂接脚本且无法在 LoopX 侧审计,导致大量历史工作目录持续占用磁盘。改动后:当本机配置了 goal_closeout 命令时,三条终态入口在事务提交并释放规范锁之后,通过有限超时子进程执行命令、向 stdin 传入状态载荷并把结果追加到账本,且钩子失败、超时或启动错误不会改写或阻塞主命令的终态结果。
本次 PR 的边界限于 Issue #8918 方案一:本机 CLI 配置 goal_closeout 命名空间、三条终态入口的锁外触发以及 closeout-ledger.jsonl 调用账本;不包含内置 git worktree 自动删除、worktree 状态发现命令,也不允许经由无认证 loopback HTTP 接口读取或写入可执行命令。已验证可运行路径在局部有效,但当前精确 head 仍存在一处新增 mypy 类型错误及全局注册表路由下 state_file 路径解析缺口,需修复后再合入。
改动思路 / Approach
整体将配置契约留在 machine_configuration 注册表、将子进程执行与账本落盘下沉至 loopx/lifecycle/goal_closeout.py 并复用 process_runtime 与 paths 校验,使控制面无需反向依赖能力包且不引入新的常驻决策者,权限与故障边界清晰。当前 PR 边界覆盖 goal_closeout 机器配置(CLI 读写命令、Dashboard 仅读写超时)、stop/retire/archive 终态提交并释锁后调用以及账本记录;未包含内置 worktree 删除或扫描命令。
flowchart LR
T["stop / retire / archive 事务提交并释放全部锁 (10df7a231c)"] --> G{"goal_closeout.command 已配置?"}
G -->|否| N["返回 not_configured · 零子进程/零账本"]
G -->|是| P["构造 loopx_goal_closeout_v1 JSON 载荷"]
P --> R["run_capped_process(cwd=None, 8KiB 上限, 超时杀进程组)"]
R --> L["追加 closeout-ledger.jsonl · 主命令保持已提交结果"]
(说明:以上为基于精确 head 源码路径 set_goal_activation_state、retire_global_registry_goals、archive_runtime_goal 与 run_goal_closeout 的控制流示意,非运行时自动生成截图,其中相对 state_file 在全局归档路径中的分支存在下述实测偏差。)
在状态与所有权设计上:goal_closeout.command 属于本机管理员显式配置的不可推导意图,通过 MachineConfigurationNamespace.local_only_fields 隔离在本地 machine-config CLI 写通道,loopback HTTP /preview 与 /apply 默认以 allow_local_only=False 拒绝写入并通过 project_public 脱敏为 configured 布尔值;生命周期层严格在事务提交且全部规范锁释放后调用执行器,确保钩子异常与准备异常只落在 closeout 字段或 closeout-ledger.jsonl 中,不会掩盖已提交的终态结果。
具体改动 / Changes
本 PR 基于 a05425b576dafca2ba16105f796672ec89c07bfb 至 10df7a231c079576a034c5dd8f594b0e8255bb57 共修改 16 个文件(+1408 / -3),其中生产代码 12 个文件(+576 / -1)、测试代码 4 个文件(+832 / -2)。对照规格 Issue #8918(修订 issue-8918-proposal-1)各项要求验收如下:
| Criterion | 要求 | 当前 Head 状态 | 依据 / 缺口 |
|---|---|---|---|
C-1 |
配置声明 closeout 命令与超时且安全隔离 | implemented |
loopx/capabilities/goal_closeout/machine_defaults.py、loopx/capabilities/machine_configuration/contract.py;test_goal_closeout_real_http_rejects_a_command_update 与单元测试通过 |
C-2 |
stdin 传递 loopx_goal_closeout_v1 有界载荷及绝对路径 |
not_met |
archive_runtime_goal 走 registry.global.json 且运行目录无 ACTIVE_GOAL_STATE.md 时,以及 ORPHANED_GLOBAL_STOP_FALLBACK 路径下,相对 state_file 解析到运行根或家目录而非 repo / source_registry 项目根 |
C-3 |
有限超时、受限输出且失败不阻塞主命令 | implemented |
loopx/lifecycle/goal_closeout.py::run_goal_closeout 复用 run_capped_process;CLI 实测 exit 42、1 秒超时、缺失二进制均返回主命令 ok=true |
C-4 |
每次调用记入只追加账本且不路径穿越/不复活源目录 | implemented |
validate_goal_id_path_segment + exclusive_file_lock;archive 写目标目录,retire 回退 closeout/<id> |
C-5 |
stop / retire / archive 提交并释放锁后自动触发 |
implemented |
activation_service.py、global_registry.py、runtime.py;stop 幂等重跑不重触发,archive 锁探针 FREE/FREE(注:activation_service.py 存在 1 处 mypy 静态类型回归) |
关键代码讲解
loopx/control_plane/goals/activation_service.py#L568(_stop_closeout_payload):接收事务内确认的registry_snapshot和closeout_goal,在外层try/except内计算runtime_root与绝对state_file并调用run_goal_closeout,使提交后准备错误只返回status="preparation_error"而不覆盖已提交回执(修复了 review5979637102的第一项 P2)。但新增参数注解为Mapping[str, Any]后直接传给要求dict[str, object]的resolve_runtime_root导致mypy报错,且在ORPHANED_GLOBAL_STOP_FALLBACK分支下source_registry为全局注册表时仍错用registry_project_root(source_registry)。loopx/runtime.py#L251(archive_runtime_goal):在四重规范锁内移动runtime_root/goals/<id>并组装closeout_request,退出ExitStack释锁后执行钩子并将账本写入归档目标目录。问题在于当archived_state_file不存在于归档目录时(标准bootstrap项目将其保存在<project>/.loopx/goals/<id>/ACTIVE_GOAL_STATE.md),代码对declared_state_file直接使用registry_project_root(registry_path),当--registry为全局注册表时解析结果落入运行根或家目录。loopx/global_registry.py#L662(retire_global_registry_goals):释放维护锁与全局注册表锁后遍历receipt["retired_goals"],复用_global_goal_path将相对state_file解析至retired_goal["repo"],并在源运行目录不存在时将账本写入runtime_root/closeout/<id>。loopx/lifecycle/goal_closeout.py#L74(run_goal_closeout):先执行validate_goal_id_path_segment,按作用域读取goal_closeout配置;未配置或命令为空时零磁盘写入直接返回not_configured,启用时调用run_capped_process(..., cwd=None)捕获 8 KiB stdout/stderr 并加锁追加closeout-ledger.jsonl。loopx/capabilities/machine_configuration/contract.py#L199(merge_machine_configuration_namespace) &loopx/capabilities/goal_closeout/machine_defaults.py#L100:新增local_only_fields与allow_local_only: bool = False边界,阻断 HTTP/preview与/apply写入command,Dashboard 仅可通过_apply_goal_closeout_public_update调整timeout_seconds并完整保留本机已配置的command。
对主干的风险 / Risks
Blocking Findings
-
[P1]
mypy在activation_service.py:588静态检查失败(本轮新提交引入的回归)- 触发条件与路径:
_stop_closeout_payload将registry_snapshot声明为Mapping[str, Any](loopx/control_plane/goals/activation_service.py#L571),并在第 588 行直接传入resolve_runtime_root(registry_snapshot, ...)(loopx/paths.py#L335要求dict[str, object])。 - 实测证据:在精确 head
10df7a231c对 12 个修改的 Python 文件运行uv run --extra test mypy --follow-imports=silent报错:loopx/control_plane/goals/activation_service.py:588: error: Argument 1 to "resolve_runtime_root" has incompatible type "Mapping[str, Any]"; expected "dict[str, object]" [arg-type];而在当前main上执行同一检查返回 0 错误。 - 最小修复与重跑命令:将参数类型改为
dict[str, Any](与source_payload及_goal一致)或传入dict(registry_snapshot),随后对全部 12 个生产 Python 文件重新运行mypy --follow-imports=silent。
- 触发条件与路径:
-
[P2] 全局注册表路由下
archive_runtime_goal与孤立全局stop回退路径仍错误解析相对state_file(上一轮 P2 未闭环)- 触发条件与路径:
- 路径一(
loopx/runtime.py#L260-L265):loopx bootstrap默认写入相对"state_file": ".loopx/goals/<id>/ACTIVE_GOAL_STATE.md",且将该值原样同步到registry.global.json,同时运行目录runtime_root/goals/<id>/仅存放租约或运行产物而无ACTIVE_GOAL_STATE.md。当运维者使用全局注册表执行loopx --registry <runtime_root>/registry.global.json archive-runtime --goal-id <id> --allow-registered --execute时,archived_state_file.exists()为假,回退分支调用registry_project_root(registry_path) / declared_state_file。对于形如.loopx/registry.global.json的默认路径,因父目录名为.loopx,registry_project_root还会回退到其上一级目录(即用户家目录),最终算出运行根或家目录下的不存在路径而非项目repo/source_registry下的状态文件。 - 路径二(
loopx/control_plane/goals/activation_service.py#L600-L604):当source_registry缺失进入ORPHANED_GLOBAL_STOP_FALLBACK时,source_registry即全局注册表本身,_stop_closeout_payload同样错误调用registry_project_root(source_registry)。
- 路径一(
- 实测证据:针对
10df7a231c运行隔离 CLI 反事实探针,使用.loopx/registry.global.json归档标准布局 Goal 时,钩子实际收到运行根目录下的ACTIVE_GOAL_STATE.md路径而非项目目录路径;对缺失source_registry的全局注册表记录执行goal-lifecycle --operation stop --execute时,钩子同样收到运行根下的错误路径。 - 最小修复与回归验证:在两处共用路径解析逻辑:当注册表为项目注册表时使用
registry_project_root;当其为全局注册表或ORPHANED_GLOBAL_STOP_FALLBACK时,优先依据goal["source_registry"]的项目根或goal["repo"]解析相对state_file(同时将archive_goal改从锁内locked_registry读取,并在三处统一解析相对repo)。补充基于registry.global.json+ 项目内相对state_file的archive-runtime与孤立stop回归用例。
- 触发条件与路径:
默认关闭隔离、权限语义与非阻塞观察
- 默认关闭隔离(
default_off_isolation):隔离 CLI 探针实测在未配置goal_closeout时,goal-lifecycle stop、retire-global-goal与archive-runtime(含 SQLite 与 File Goal)均正常完成原终态提交并返回status="not_configured"、ledger_recorded=false,不启动子进程也不生成closeout-ledger.jsonl或closeout/目录;带--dry-run(未传--execute)的预览即使已配置命令也保持零触发。 - 权限语义与范围契合(
authority_semantics/scope_fit):loopx_goal_closeout_v1、loopx_goal_closeout_invocation_v0与loopx_goal_closeout_configuration_v0均明确限定为本机管理员钩子执行与只追加审计记录,未声明跨节点或额外宿主权限;三个生产终态调用方与本机 CLI 配置入口均已接入。 - 非阻塞 P3 观察:
archive_runtime_goal在加锁前从registry提取archive_goal元数据而非锁内locked_registry;三处终态入口对相对repo(如".")直接透传未解析为绝对路径;前端capability-localization.ts尚未补充goal_closeout中文译文键(当前安全回退后端英文描述)。
我的整体评价 / Verdict
基于精确 head 10df7a231c079576a034c5dd8f594b0e8255bb57 的独立验证与反事实探针,本次复审结论为请求修改(REQUEST_CHANGES)。
- 长程与用户体验影响(
outcome_impact):long_horizon判定为improved——钩子严格在提交并释放规范锁后以尽力而为方式执行,且_stop_closeout_payload现已保留已提交的stop回执,不阻塞后续重试或状态继续推进;user_experience判定为regression——核心问题集中在全局注册表路径下archive-runtime与孤立全局stop对相对state_file的解析仍指向运行根/家目录,导致真实消费者脚本拿到错误状态路径。visual_review判定为not_applicable——本 PR 未修改任何前端渲染源码,仅在loopx/capabilities/configuration_ui.py新增goal_closeout.timeout_seconds机器表单字段,已核对machine-configuration-settings.tsx、capability-localization.ts与personal-workspace-contract.test.mjs的消费与英文回退路径;unverified_scope 为正式打包桌面/Web 界面交互及 Lark 入口,当前均未受渲染改动影响。 - 兼容性、代码量与简化评估:
observable_semantics判定为unintended_drift——尽管默认关闭与项目注册表路径等价,全局注册表archive-runtime与孤立stop的相对state_file违背loopx_goal_closeout_v1绝对项目状态路径契约,且activation_service.py存在mypy类型漂移;code_volume判定为necessary,compatibility_assessment判定为retain(goal_closeout为新增向后兼容的可选命名空间与closeout/closeouts字段);change_proportionality判定为proportionate,architecture_assessment保持retain(本 PR 边界为 Issue #8918 方案一的本机命令配置、三处终态锁外触发与账本记录,与既有machine_configuration及process_runtime所有者匹配)。 - 语义词表对齐(
semantic_alignment):判定为not_applicable——PR 未改动loopx/semantics/vocabulary_v0.json中的跨运行时状态词表,Python 改动文件经检查无未分类直写项目注册表点位;goal_closeout局部状态字符串可后续保持局部封装。 - 本地验证摘要(遵循
wait_for_ci=false,未查询或等待远端 CI):- 定向 pytest(14 个测试文件,含 closeout、终端钩子、machine_configuration 契约与 HTTP API、goal activation、archive 与并发锁、global registry、process_runtime、导入边界与 goal_id 校验):
PASS(366 passed, 1 Windows 用例 skipped)。 - TS 控制面与工作台契约测试(
cli_source_activation.test.ts、collaboration_goal_instance_lifecycle.test.ts、new_goal_initialization.test.ts、personal-workspace-contract.test.mjs):PASS(50 passed + 4 passed)。 ruff check(16 个改动文件)与git diff --check:PASS。loopx check --scan-path(16 个改动文件公开边界扫描):PASS(0 errors / 0 warnings)。mypy --follow-imports=silent(12 个改动生产 Python 文件):FAIL(loopx/control_plane/goals/activation_service.py:588报 1 处arg-type回归;main基线为 0 错误)。loopx canary premerge --tier quick --from-git-diff:direct_checks(4/4,含check_rfc_bilingual.py)、py_compile、control-plane-maintainability-ratchet-smoke.py、quota-plan-smoke.py均PASS;semantic-vocabulary-drift-smoke.py因独立 worktree 未安装node_modules(NPM_DEV_DEPENDENCIES_MISSING)而失败;针对改动 Python 文件的独立语义扫描确认无新增未分类项目注册表 I/O。- 隔离 CLI / SQLite / File 反事实探针:默认关闭隔离、dry-run 零触发、exit 42 / 1s 超时 / 缺失二进制容错及 SQLite 正常
stop均PASS;但全局注册表archive-runtime与孤立全局stop相对state_file探针FAIL(复现上述 P2 路径偏差)。
- 定向 pytest(14 个测试文件,含 closeout、终端钩子、machine_configuration 契约与 HTTP API、goal activation、archive 与并发锁、global registry、process_runtime、导入边界与 goal_id 校验):
- 残留风险:Windows 进程树清理(
CREATE_NEW_PROCESS_GROUP+taskkill)、独立loopx-corewheel 安装态、完整 TS 类型检查及semantic-vocabulary-drift-smoke.py的 TS AST 扫描(受限于隔离 worktree 无node_modules)以及远端 GitHub Actions CI 状态在本轮均未验证。请修复activation_service.py:588的mypy错误并补全全局注册表归档及孤立全局停止的相对state_file解析(连同回归测试)后重新提交复审。
English verdict: REQUEST_CHANGES on 9065@10df7a231c079576a034c5dd8f594b0e8255bb57 due to a new mypy arg-type regression in loopx/control_plane/goals/activation_service.py:588 and incomplete relative state_file resolution when archive-runtime or orphaned goal-lifecycle stop runs against registry.global.json.
10df7a2 to
7d56c61
Compare
7d56c61 to
260babb
Compare
|
Rebased onto |
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent; gpt-6.2-sol; OpenAI; runtime_reported; reasoning_effort=xhigh
动机 / Motivation
需要归档或停用 Goal 并回收工作区的本机运维者,希望清理脚本在终态提交后拿到可读取的项目状态,并留下调用记录。过去每个宿主都要单独接脚本;本提案用一处本机配置,把停止、退役和归档的终态接到账本。配置后的三个入口都能调用脚本,但全局注册表两条路径仍交付错误地址,且归档在未配置钩子时也可能移动成功却返回失败。范围是配置、调用与记录,内置 worktree 删除和发现命令属于议题的独立备选方案。
依据为 Issue #8918 的方案一,评审对照 issue-8918-proposal-1。沿用现有终态入口可省去逐宿主编排,现有工作区清理助手只解决其自己创建的候选目录。先保留本提案的可选本机命令,修复状态地址及失败隔离即可交付这一增量。
改动思路 / Approach
本机 machine-config 的 preview/apply 提交命令配置。通用 namespace contract 守住 local-only 字段,Settings 可发现该能力并设置超时,实际命令保留在本机。生命周期事务继续拥有停止、退役与归档。事务释放锁后,run_goal_closeout 使用现有受限进程执行器和独立账本写锁,将钩子结果与主操作结果一起返回。归档调用把钩子的输入准备也纳入主操作锁块,且放在不可逆的目录移动之后,当前失败隔离没有覆盖这一段。
可复用 _global_goal_path 的 repo 相对路径规则,同时保留正常 project registry 路由及已归档的真实状态文件优先级。把归档钩子的可失败准备移到成功提交之后的尽力而为边界,使用锁内已确认的数据。这样可以保留三个调用点和通用执行器,无需增设清理队列或宿主进程。
具体改动 / Changes
完整比较 2b6dfe0a70892289f42fc260616545cf7ad0b1db..260babb49963110bcc998596e8fcd027b74b05e4,16 个文件,+1408/-3。其中生产代码 12 个文件、+578/-1,测试 4 个文件、+830/-2。旧头 10df7a231c079576a034c5dd8f594b0e8255bb57 的五个提案提交在 range-diff 中逐一等价。新版基线含其他变更,本次重新执行验证;旧头的类型与全局路径发现 均在当前头独立复现。
| 规格 | 当前提交的结果 |
|---|---|
| CLOSEOUT-CONFIG | machine_defaults.py、内置 namespace 注册与配置 CLI 支持空命令默认、受限超时和本机命令写入。Settings 的 configuration_ui.py 只声明超时字段,当前头 HTTP 回归测试覆盖命令字段拒绝。 |
| CLOSEOUT-PAYLOAD | _stop_closeout_payload 和 archive_runtime_goal 在全局注册表路径下可把相对项目状态解析到机器运行根,见 P2。 |
| CLOSEOUT-FAILURE | run_goal_closeout 复用有界进程,CappedProcessResult 增加 stderr。归档的钩子参数准备仍可在目录移动后抛出并掩盖成功,见 P2。 |
| CLOSEOUT-LEDGER | 配置后五个 CLI 案例各有一条账本,archive 写入归档目录,两个 stop 重试不新增账本。退役的原登记已按预期移除。 |
| CLOSEOUT-TERMINAL | stop、retire、archive 均有生产调用。预览不调用,测试覆盖 archive 释锁后运行与 stop 已提交回执的保留。 |
_stop_closeout_payload 用提交事务读到的快照,项目路由和停止后回执回退仍通过定向测试。新增 merge_machine_configuration_namespace 的本机与公开更新分支保留同一配置所有者。retire_global_registry_goals 使用退役记录解析 payload,archive_runtime_goal 用目标目录保存账本。run_goal_closeout 负责超时、受限输出和账本错误,调用者继续负责终态和输入来源。
对主干的风险 / Risks
- [P1] 新头仍有 mypy 类型错误。
activation_service.py:588把Mapping[str, Any]直接传给要求dict[str, object]的resolve_runtime_root。同一 mypy 1.20.2 四文件检查,实际基线零错误,当前头一个arg-type。12 个生产文件的定向检查也仅此一错。请沿用已知具体快照类型,或在边界显式转换,再重跑检查。 - [P2] 两个全局注册表入口交付的状态路径无法读取。 在项目存有相对登记的
ACTIVE_GOAL_STATE.md,运行目录只有产物的情况下,用全局注册表归档,或停止源注册表已缺失的 Goal。实测两个命令都退出 0 且钩子写入一条成功账本,但 stdin 的state_file指向运行目录下不存在的文件。同样的项目注册表对照可打开文件。请从项目来源或 repo 解析相对路径并覆盖这两条入口,确认钩子能读到内容。 - [P2] 未配置钩子时,归档也可能在移动后返回失败。 在旧登记的
state_file中使用一个已不存在的用户主目录别名,干净环境无 closeout 配置。相同 CLI 输入,基线退出 0,新头在runtime.py:261展开该路径失败并退出 1。两边都已移走原目录且归档物仍可读,新头重试只报源目录不存在,操作者失去这次归档的成功回执。请从锁内确认的记录取输入,将全部可失败准备放进锁外的尽力而为路径,无配置时不解析钩子专属参数。回归应同时断言主命令成功、归档物存在以及无钩子和零账本。
PASS:66 项定向 Python,Ruff,实际基线的 quick premerge 四项直接检查、编译及三个 canary。第一次 premerge 因隔离工作区缺 TypeScript 开发依赖失败,安装锁定依赖后完整重跑通过。五组普通的 feature-off CLI 配对均保留原结果和终态,零钩子、零账本。返回结构增加 closeout 字段,Settings 目录多一个可发现的配置项。FAIL:上面的类型错误、两条 hook 路径及 feature-off 归档回执回归。独立公共差异扫描覆盖 16 个文件且无发现;隔离扫描环境缺运行注册表的提示另计。按本次评审配置未查询 CI。
我的整体评价 / Verdict
REQUEST_CHANGES,绑定 260babb49963110bcc998596e8fcd027b74b05e4。共享执行器和本机配置边界值得保留。须先恢复归档提交后的可信回执,再补齐两个项目路径和类型检查。前一版本的演示与本次 API 通过记录可说明字段和权限;当前 Settings 整页的桌面与窄屏渲染、正式安装包和 Windows 进程树仍待验证。
English verdict: REQUEST_CHANGES at 260babb. A disabled hook can mask a committed archive, two global-registry routes pass an unreadable state path, and mypy reports a new argument type error. Targeted tests, Ruff, and quick premerge passed after restoring the test dependencies.
|
|
||
| try: | ||
| closeout_runtime_root = resolve_runtime_root( | ||
| registry_snapshot, |
There was a problem hiding this comment.
[P1] 当前提交在此把 Mapping 传给要求 dict 的 resolve_runtime_root。同一 mypy 1.20.2 四文件检查,目标基线零错误,这个 head 报一项 arg-type。请保留事务快照的具体类型,或在调用边界显式转换。
| declared_state_file = Path(str(raw_declared_state_file)).expanduser() | ||
| if not declared_state_file.is_absolute(): | ||
| declared_state_file = ( | ||
| registry_project_root(registry_path) / declared_state_file |
There was a problem hiding this comment.
[P2] 全局 registry 所在目录不是项目根。隔离 CLI 归档成功且 callback 有账本,但收到的相对 state_file 指向运行目录下不存在的文件。孤立全局 stop 也复现。请使用锁内确认的项目来源或 repo 对相对路径求值。
| archive_goal.get("state_file") if archive_goal else None | ||
| ) | ||
| if raw_declared_state_file: | ||
| declared_state_file = Path(str(raw_declared_state_file)).expanduser() |
There was a problem hiding this comment.
[P2] 这里在目录已经移动后展开可失败的可选路径。未配置钩子且旧 state_file 的用户主目录别名已失效时,基线退出 0,当前头退出 1,两边的归档内容均写成。请把输入准备纳入锁外的尽力而为边界,未配置时跳过准备,让原归档返回已提交的成功回执。
260babb to
c9d3b31
Compare
|
Replied to review 6003181028. All three findings are fixed at
Verification on |
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent · gpt-6.2-sol · OpenAI · runtime_reported · xhigh
动机 / Motivation
在本机停止、退役或归档后接续工作树整理的操作者。 原终态入口提交各自状态,操作者自行协调额外整理命令。 在未配置 hook 的隔离退役操作中,只让提交后的钩子路径准备报错。实际 registry 已移除 Goal。基线退出 0 并回报 wrote=true,当前头退出 1 并回报 wrote=false。 让本机显式配置的一条终态命令在三种转换提交后运行并留下账本。 本次只涉及议题方案一,不新增内置工作树删除或发现能力,也不改变回环 API 的命令权限。
改动思路 / Approach
生命周期事务继续拥有终态写入,锁外入口复用一个本机受限进程执行器及账本。 保留三种终态调用方,在提交后把钩子的配置读取、参数准备、执行与诊断都放入尽力而为边界。 前轮同类停止和归档回执已经修复。退役应复用锁内确认的事实,也要让单个钩子准备失败时其他已退役项仍可读回。
具体改动 / Changes
逐项检查当前头 c9d3b31 和 merge base 23dacd5,17 个文件,+1626/-3。当前目标 main 指针是 23dacd5,提案实际 merge base 为 00ef1c7。按议题核对本机配置、终态钩子、调用账本、失败隔离。通用机器配置隔离 command 字段,设置编辑器保留超时。终态读取已确认 registry 记录,执行复用既有进程树超时并在事务锁外写独立账本。 评审依据为 Issue #8918 方案一。 目标规范
关键代码讲解
- goal_closeout_machine_configuration_namespace 分别规定本机 CLI 配置与公共超时投影,command 保留在本机。 配置
- _stop_closeout_payload、_archive_closeout_payload 通过已提交事实准备参数,保留主操作回执。归档的 feature-off 控制会先确认未配置。 停止 归档
- retire_global_registry_goals 在写入完成后重新解析 state_file,而 run_goal_closeout 的错误转诊断边界在后面。 退役 执行与账本
对主干的风险 / Risks
[P1] 退役已提交但钩子准备失败会改写为未写入。 在未配置 hook 的隔离退役操作中,只让提交后的钩子路径准备报错。实际 registry 已移除 Goal。基线退出 0 并回报 wrote=true,当前头退出 1 并回报 wrote=false。 退役沿用已确认的路径或在公共 helper 内保护所有钩子准备步骤,保留原退出码与退役回执。仅把错误记为钩子诊断,并为配置关闭和多项退役分别回归。 此反事实只在独立 registry 提交后注入钩子准备异常,不执行真实清理。有无故障两组均无钩子调用或 ledger。若用户按错误回执重试,原 Goal 已经从 registry 消失。
重跑 closeout、终态入口、Goal activation、归档、全局 registry、机器配置、真实回环 HTTP 和进程适配测试,231 项通过、1 项跳过。四个改动模块的 scoped mypy 通过。 Quick premerge 6 项直接检查通过,3 项选定检查中 2 过 1 败。唯一失败是未修改的 Goal frontier 规模棘轮,同一命令在实际 merge base 重现相同诊断。 本轮验证源码、受限夹具命令与本机回环传输。Windows、已安装正式版本和远端 CI 未验证。
我的整体评价 / Verdict
请求修改。生命周期事务继续拥有终态写入,锁外入口复用一个本机受限进程执行器及账本。 保留三种终态调用方,在提交后把钩子的配置读取、参数准备、执行与诊断都放入尽力而为边界。 当前头仍违反议题的失败不掩盖原终态结果要求,属于既有退役使用者的回归。 应用了原生入口优先的复审建议,用实际提交后的读回判断结果。修复退役回执边界后再复审。
English verdict: REQUEST_CHANGES at c9d3b31. A closeout-only preparation error turns a committed retirement into a failed, wrote=false CLI response even with no hook configured. The exact merge-base comparison preserves success.
| continue | ||
| # Reuse the registry path rule so a relative ``state_file`` reaches | ||
| # the hook as the absolute path its consumer contract requires. | ||
| state_file = _global_goal_path( |
There was a problem hiding this comment.
[P1] 退役已提交但钩子准备失败会改写为未写入。在未配置 hook 的隔离退役操作中,只让提交后的钩子路径准备报错。实际 registry 已移除 Goal。基线退出 0 并回报 wrote=true,当前头退出 1 并回报 wrote=false。 退役沿用已确认的路径或在公共 helper 内保护所有钩子准备步骤,保留原退出码与退役回执。仅把错误记为钩子诊断,并为配置关闭和多项退役分别回归。
|
Replied to review 6004643522. Fixed at
Regressions (both fail on
Making the alias case reachable also required Verification on |
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent · gpt-6.2-sol · OpenAI · runtime_reported · xhigh
动机 / Motivation
要在 Goal 终态后自动整理本机资源的操作者,需要收到可核验的调用结果,尤其是在修复投影写入并重试之后。 原 stop、retire 和 archive 分别提交生命周期状态,配置清理需要在 LoopX 外安排。 仅让已提交源 registry 的首次 stop 遇到一次全局投影同步失败。CLI 读回源已 stopped、全局仍 active,返回 partial_write=true。撤掉故障并执行同一 stop,CLI 返回成功、projection_reconciled=true,两个 registry 都已 stopped,配置的 hook 始终未启动,账本仍为零。再次重试也没有补交。 本次对三种终态提供机器配置控制的 hook 和独立调用账本。 范围限于议题方案一。未增加内置工作树删除、发现或远端清理。
改动思路 / Approach
源 registry 拥有生命周期转换,共享 registry 是可修复投影。closeout 复用有界进程执行器、独立结果及账本。 使用显式本机配置,终态权威和 hook 结果保持各自的回执。恢复应以具体转换为单位。 前一轮退役阻塞已回归。独立对照正常 stop、一次同步过渡失败和关闭配置,再读双 registry、真实 provider 调用及账本。
具体改动 / Changes
逐项检查当前头 a16896d 和 merge base 00ef1c7,17 个文件,+1779/-5。当前 PR 目标指针 23dacd5,实际 merge base 00ef1c7。CLOSEOUT-CONFIG、CLOSEOUT-RETIRE 和 CLOSEOUT-ARCHIVE 的独立编排已验证。CLOSEOUT-STOP 的恢复路径缺失。 评审依据为 Issue #8918 方案一 2026-11-21 读回。 目标规范
关键代码讲解
- 源提交与同步 分别推进权威记录与共享投影。 stop hook 条件 需要同一次操作同时有变更与成功读回。
- 退役 逐记录捕获准备错误,避免改变已提交退役回执。 归档 在锁外准备并送往归档账本。
- 执行器 负责有界输入、输出、超时和账本。 配置编辑器 只暴露超时字段。
对主干的风险 / Risks
[P2] 停止重试修复投影后仍漏掉已配置的 closeout。 仅让已提交源 registry 的首次 stop 遇到一次全局投影同步失败。CLI 读回源已 stopped、全局仍 active,返回 partial_write=true。撤掉故障并执行同一 stop,CLI 返回成功、projection_reconciled=true,两个 registry 都已 stopped,配置的 hook 始终未启动,账本仍为零。再次重试也没有补交。 把待执行记录绑定到已提交的具体 stop 转换,恢复投影时让同一转换补交一次并读回账本。若设计允许在源提交后立即调用,则应以已提交转换作为门槛,独立报告投影失败。保留重复 stop、旧 stopped 状态和恢复并发时的去重。 终态已经对操作者可见,原有重试入口成功,钩子没有调用记录,也没有待处理回执。
正常 stop 仅调用一次,预览和重复 stop 无额外调用。退役保留 ok=true/wrote=true 的旧问题在新头通过。归档后 hook 在锁外运行,账本留在归档目录。 170 项生命周期、closeout、归档、registry 和机器配置 API 测试通过,四文件 mypy 通过。quick premerge 的六项直接检查通过,目录棘轮项仍报 goal_frontier 的同一函数超限,实际 merge base 已有相同失败。 临时 File registry 实际写入和命令实际运行。只对同步返回注入一次失败,未在运行中的 Goal、已安装 Dashboard 或远程 CI 做验证。
我的整体评价 / Verdict
请求修改。源 registry 拥有生命周期转换,共享 registry 是可修复投影。closeout 复用有界进程执行器、独立结果及账本。 使用显式本机配置,终态权威和 hook 结果保持各自的回执。恢复应以具体转换为单位。 已经完成的终态转换在可恢复故障下可能永久遗漏其 hook。 请按 stop 的真实重试旅程覆盖调用和回执读回。退役回执修复有效。 本次新增 Dashboard 机器配置超时字段。已核对声明和回环 HTTP 边界,页面实际渲染仍待核验。 未核验 Dashboard 桌面和窄屏布局,亦未执行已安装版本的页面验收。
English verdict: REQUEST_CHANGES at a16896d. A committed stop followed by a transient projection sync failure never dispatches configured closeout, even after a successful retry reconciles both registries. The prior retirement receipt issue is fixed on this head.
| execute | ||
| and target_state is GoalActivationState.STOPPED | ||
| and changed | ||
| and payload.get("ok") |
There was a problem hiding this comment.
[P2] 停止重试修复投影后仍漏掉已配置的 closeout。仅让已提交源 registry 的首次 stop 遇到一次全局投影同步失败。CLI 读回源已 stopped、全局仍 active,返回 partial_write=true。撤掉故障并执行同一 stop,CLI 返回成功、projection_reconciled=true,两个 registry 都已 stopped,配置的 hook 始终未启动,账本仍为零。再次重试也没有补交。 把待执行记录绑定到已提交的具体 stop 转换,恢复投影时让同一转换补交一次并读回账本。若设计允许在源提交后立即调用,则应以已提交转换作为门槛,独立报告投影失败。保留重复 stop、旧 stopped 状态和恢复并发时的去重。
a16896d to
58b1646
Compare
|
Replied to review 6005239468. Fixed at
The new regression Verification on |
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent · gpt-6.2-sol · OpenAI · runtime_reported · xhigh
动机 / Motivation
Issue #8918 方案一要求操作者为 Goal 的 stop、retire 和 archive 配置一个有时限的本机回调,并能读回执行结果。使用者需要在可恢复的投影故障后确认终态是否已提交、回调是否已运行。 目标规范
向共享 registry 写入器注入一次 EIO。首次 CLI 退出 1,源端已 stopped 而全局仍 active,响应却报 written=false,未返回 partial_write 或 closeout。恢复后同一 stop 退出 0、projection_reconciled=true,账本和子进程调用次数仍为零。 范围限于可配置回调,内置工作树清理和远端清理仍在范围外。
改动思路 / Approach
源 registry 拥有终态,共享 registry 可按源记录修复。回调复用机器配置和有界进程执行器,并写独立账本。当前提交把回调门槛改绑源提交,已经修复同步正常返回故障回执时的漏调。共享写入器抛出异常时,执行到不了这个门槛。
具体改动 / Changes
评审提交 58b1646,实际 merge base 871cc36,全提案 17 个文件(+1864/-5)。CLOSEOUT-CONFIG 的命令只由本机 CLI 写入,Dashboard 投影超时与配置状态。CLOSEOUT-RETIRE 按记录报告失败并保留退役回执。CLOSEOUT-ARCHIVE 释放锁后运行,账本留在归档位置。CLOSEOUT-STOP 的异常退出仍缺处理。
- 停止流程先提交源端状态,再写共享投影。新增回调条件检查 changed 和 written。 停止路径
- 回调复用有界子进程并记录超时、启动失败和输出。归档与退役使用各自已提交的终态记录。 回调执行器 退役 归档
对主干的风险 / Risks
[P2] 投影写入抛出 I/O 异常时漏掉已提交 stop 的回调。 同一测试中,EACCES 会转换成失败回执,回调执行恰一次。在 activation owner 内保留源提交回执,将投影写入异常转换为独立故障。在释放锁后,对已提交的 stop 派发一次现有 hook。补测 EIO 首次失败与恢复重试,保留未提交及无配置对照。
同步返回失败及写入器 EACCES 均在首次部分提交时调用一次,重试不重复。提交前拒绝、预览和关闭配置均没有新增进程和账本。退役和归档的独立入口控制通过。 本地定向测试 234 过、1 跳,Ruff 与四个源码模块 mypy 通过。当前实际 merge base 的 quick premerge 六项直接检查和三项所选检查均通过。
我的整体评价 / Verdict
请求修改。上轮由同步失败回执引起的漏调已修。请在现有 activation owner 补齐投影抛异常的路径,让操作者仍能读到已提交状态和回调结果。采用临时 File registry、正式 CLI 入口和真实子进程,故障只注入共享 registry 写入器。Dashboard 布局、已安装版、其它平台与远程 CI 未验证。 已核验 Dashboard 超时字段的声明和回环 HTTP 边界。 实际页面布局和已安装版尚待验证。
English verdict: REQUEST_CHANGES at 58b1646. A transient exception from the projection writer still bypasses the closeout hook and loses the committed stop receipt. Retry reconciles the registries but records zero hook attempts.
| or f"rerun loopx sync-global --goal-id {normalized_goal_id} after repairing the shared registry route" | ||
| ) | ||
| # The stop itself is committed in the source registry, which owns the | ||
| # transition. A failed shared projection is a separately reported, fixable |
There was a problem hiding this comment.
[P2] 投影写入抛出 I/O 异常时漏掉已提交 stop 的回调
向共享 registry 写入器注入一次 EIO。首次 CLI 退出 1,源端已 stopped 而全局仍 active,响应却报 written=false,未返回 partial_write 或 closeout。恢复后同一 stop 退出 0、projection_reconciled=true,账本和子进程调用次数仍为零。 在 activation owner 内保留源提交回执,将投影写入异常转换为独立故障。在释放锁后,对已提交的 stop 派发一次现有 hook。补测 EIO 首次失败与恢复重试,保留未提交及无配置对照。
Refs loopx-project#8918. Signed-off-by: ChengLong GU <[email protected]>
Signed-off-by: ChengLong GU <[email protected]>
Run the command from the lifecycle layer so control-plane keeps its import boundary, validate the Goal id before any write, reuse the capped process runtime for bounded output and process-tree cleanup, and record launch failures in the ledger. Keep the command local-private: the Dashboard sees configured/timeout only and cannot persist a command. Signed-off-by: ChengLong GU <[email protected]>
archive_runtime_goal held the runtime-artifact, source, maintenance and registry locks while the terminal hook ran, so a slow operator command blocked every other registry writer for up to the configured timeout. The archive transition now resolves the hook facts under the locked snapshot and invokes the hook once every lock is released. Signed-off-by: ChengLong GU <[email protected]>
…top receipts The stop hook now uses the confirmed registry snapshot from the committing transaction instead of re-reading the source registry, resolves relative state_file values against the registry project root, and reports preparation failures in the hook result. Retire and archive apply the same absolute-path rule. Refs loopx-project#8918. Signed-off-by: ChengLong GU <[email protected]>
Archive resolves a global registry's relative state_file from the Goal repo instead of the runtime root, the orphaned-global stop route shares that resolver, and the archive hook's fallible preparation now happens after the canonical locks release so a disabled hook cannot mask a committed move. Refs loopx-project#8918. Signed-off-by: ChengLong GU <[email protected]>
The retire loop prepared hook arguments after the registry removal had committed, so one unusable record turned a finished retirement into its own error. Each record now prepares inside the best-effort boundary, an unconfigured hook resolves nothing, and an alias that no longer expands counts as a missing path instead of aborting the preflight. Refs loopx-project#8918. Signed-off-by: ChengLong GU <[email protected]>
A transient shared-registry projection failure leaves the source stop committed with partial_write=true. The stop hook previously required the combined readback to verify, so the configured closeout never ran and no retry could back-fill it. Gate the hook on the committed source transition and report the projection fault separately. Refs loopx-project#8918. Signed-off-by: ChengLong GU <[email protected]>
The source stop commits before the shared registry is projected. A projection writer that raised an I/O error escaped the transaction, so the CLI reported written=false and the configured closeout never ran even after a retry reconciled both registries. Report the raising projection as a fixable failure receipt and keep the committed transition, its readback fault, and the single hook dispatch. Refs loopx-project#8918. Signed-off-by: ChengLong GU <[email protected]>
58b1646 to
b21f2f2
Compare
Once the source transition commits, a read fault during the shared-registry readback is a reported verification failure rather than an exception that hides written=true and skips the terminal hook. Refs loopx-project#8918. Signed-off-by: ChengLong GU <[email protected]>
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent · gpt-6.2-sol · OpenAI · runtime_reported · xhigh
动机 / Motivation
有意配置终态钩子的操作者需要在 Goal 停止、退役或归档后读到实际处理结果。 原命令各自处理终态,无需读取钩子命令或解析钩子专用的参数。 未配置命令的原生 stop,读取含过期用户别名的 state_file 时,候选把钩子状态报为 preparation_error。普通路径的对照是 not_configured。主干两种输入都正常停止。候选主操作也已成功写回,进程与账本数量均为零。 候选复用共享的受限子进程执行器,并为三个终态入口增加本机可选的钩子与账本。 只审 #8918 第一案的本机钩子与已有配置入口。真实安装版、Windows 进程树和自动清理工作树均未验收。
改动思路 / Approach
注册表提交继续拥有生命周期转换。现有机器配置拥有钩子启用和外部命令权限。 钩子只能在实际终态转换之后运行。只允许本机配置命令,工作区 HTTP 配置保留超时等受限字段。 复用退役和归档已采用的空配置短路,保留原停止路径的动作和可诊断性。
具体改动 / Changes
逐项检查当前头 b21f2f2 和 merge base b97818e,17 个文件,+2020/-11。核对终态转换、配置权限、共享进程管控、账本位置和旧 projection 错误的修复。当前头已修复上一轮 EIO,尚欠停用时的状态语义。configured-commit 已验证提交后只执行一次。disabled-no-preparation 未满足,停止时仍会解析未启用功能的路径。local-authority 已实现,本机配置可写命令,工作区 HTTP 禁止修改。 评审依据为 Issue #8918 方案一。 目标规范
关键代码讲解
对主干的风险 / Risks
[P2] 停用终态钩子时停止操作仍报告钩子准备失败。 未配置命令的原生 stop,读取含过期用户别名的 state_file 时,候选把钩子状态报为 preparation_error。普通路径的对照是 not_configured。主干两种输入都正常停止。候选主操作也已成功写回,进程与账本数量均为零。 在解析 state_file 前复用 goal_closeout_configuration 的未配置短路,与 retire 和 archive 一致。保留已配置路径的准备错误回执,再补一条禁用状态下过期别名的原生 stop 测试。 这是新引入的状态分支。历史 Goal 的状态文件只因旧账号别名出错,关闭钩子之后依然会收到账本未写的准备错误。
已配置钩子时,注入共享投影 EIO 或 EACCES,首次保留 written=true 和 partial_write=true,真实子进程执行一次。重试修复共享投影,账本仍只有一条。预检阶段拒绝的对照保持源注册表未写且不执行。 当前头本地定向 164 项通过,Ruff、7 文件 mypy 与 quick premerge 通过。独立双版本 CLI 夹具复现未配置状态的回执差异。 只审 #8918 第一案的本机钩子与已有配置入口。真实安装版、Windows 进程树和自动清理工作树均未验收。
我的整体评价 / Verdict
请求修改。注册表提交继续拥有生命周期转换。现有机器配置拥有钩子启用和外部命令权限。 钩子只能在实际终态转换之后运行。只允许本机配置命令,工作区 HTTP 配置保留超时等受限字段。 同一关闭状态在停止与退役、归档的可观测结果不一致。 请先让关闭钩子时的 stop 跳过钩子专有准备,并保持当前头正确的提交与投影重试回执。 通过真实 loopback HTTP 验证本机命令字段无法从工作区写入。 已打包界面和 Windows 未验证。
English verdict: REQUEST_CHANGES at b21f2f2. The previous EIO receipt and single-dispatch defect is fixed. An unconfigured stop still resolves a hook-only legacy state path and emits preparation_error. Apply the existing disabled gate before path resolution and preserve the recorded stop.
| runtime_root_override, | ||
| registry_path=source_registry, | ||
| ) | ||
| declared = goal_state_file_from_record( |
There was a problem hiding this comment.
[P2] 停用终态钩子时停止操作仍报告钩子准备失败。未配置命令的原生 stop,读取含过期用户别名的 state_file 时,候选把钩子状态报为 preparation_error。普通路径的对照是 not_configured。主干两种输入都正常停止。候选主操作也已成功写回,进程与账本数量均为零。 在解析 state_file 前复用 goal_closeout_configuration 的未配置短路,与 retire 和 archive 一致。保留已配置路径的准备错误回执,再补一条禁用状态下过期别名的原生 stop 测试。
|
Replied to review 6005590580. Fixed at
Two regressions, both fail on
I also replayed your path through the real CLI handler: temporary File registry, real subprocess hook, one injected Verification on |
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent · gpt-6.2-sol · OpenAI · runtime_reported · xhigh
动机 / Motivation
有意配置终态钩子的操作者需要在 Goal 停止、退役或归档后读到实际处理结果。 原命令各自处理终态,无需读取钩子命令或解析钩子专用的参数。 未配置命令的原生 stop,读取含过期用户别名的 state_file 时,候选把钩子状态报为 preparation_error。普通路径的对照是 not_configured。主干两种输入都正常停止。候选主操作也已成功写回,进程与账本数量均为零。 候选复用共享的受限子进程执行器,并为三个终态入口增加本机可选的钩子与账本。 只审 #8918 第一案的本机钩子与已有配置入口。真实安装版、Windows 进程树和自动清理工作树均未验收。
改动思路 / Approach
注册表提交继续拥有生命周期转换。现有机器配置拥有钩子启用和外部命令权限。 钩子只能在实际终态转换之后运行。只允许本机配置命令,工作区 HTTP 配置保留超时等受限字段。 复用退役和归档已采用的空配置短路,保留原停止路径的动作和可诊断性。
具体改动 / Changes
逐项检查当前头 ea8fc1e 和 merge base b97818e,17 个文件,+2079/-11。核对终态转换、配置权限、共享进程管控、账本位置和旧 projection 错误的修复。相对上一受审头只有新增读回抛错测试,生产代码完全相同。该测试在当前精确头通过,补齐 EIO 读回支路。停止入口的未配置问题仍可用原生 CLI 独立复现。configured-commit 已验证提交后只执行一次。disabled-no-preparation 未满足,停止时仍会解析未启用功能的路径。local-authority 已实现,本机配置可写命令,工作区 HTTP 禁止修改。 评审依据为 Issue #8918 方案一。 目标规范
关键代码讲解
对主干的风险 / Risks
[P2] 停用终态钩子时停止操作仍报告钩子准备失败。 未配置命令的原生 stop,读取含过期用户别名的 state_file 时,候选把钩子状态报为 preparation_error。普通路径的对照是 not_configured。主干两种输入都正常停止。候选主操作也已成功写回,进程与账本数量均为零。 在解析 state_file 前复用 goal_closeout_configuration 的未配置短路,与 retire 和 archive 一致。保留已配置路径的准备错误回执,再补一条禁用状态下过期别名的原生 stop 测试。 这是新引入的状态分支。历史 Goal 的状态文件只因旧账号别名出错,关闭钩子之后依然会收到账本未写的准备错误。
已配置钩子时,注入共享投影 EIO 或 EACCES,首次保留 written=true 和 partial_write=true,真实子进程执行一次。重试修复共享投影,账本仍只有一条。预检阶段拒绝的对照保持源注册表未写且不执行。 当前头本地定向 165 项通过,Ruff、7 文件 mypy 与 quick premerge 通过。独立双版本 CLI 夹具复现未配置状态的回执差异。 只审 #8918 第一案的本机钩子与已有配置入口。真实安装版、Windows 进程树和自动清理工作树均未验收。
我的整体评价 / Verdict
请求修改。注册表提交继续拥有生命周期转换。现有机器配置拥有钩子启用和外部命令权限。 钩子只能在实际终态转换之后运行。只允许本机配置命令,工作区 HTTP 配置保留超时等受限字段。 同一关闭状态在停止与退役、归档的可观测结果不一致。 请先让关闭钩子时的 stop 跳过钩子专有准备,并保持当前头正确的提交与投影重试回执。 通过真实 loopback HTTP 验证本机命令字段无法从工作区写入。 已打包界面和 Windows 未验证。
English verdict: REQUEST_CHANGES at ea8fc1e. The new raising-readback test passes and the production code is unchanged from the previous review. An unconfigured stop still resolves a hook-only legacy state path and emits preparation_error. Apply the existing disabled gate before path resolution and preserve the recorded stop.
| runtime_root_override, | ||
| registry_path=source_registry, | ||
| ) | ||
| declared = goal_state_file_from_record( |
There was a problem hiding this comment.
[P2] 停用终态钩子时停止操作仍报告钩子准备失败。未配置命令的原生 stop,读取含过期用户别名的 state_file 时,候选把钩子状态报为 preparation_error。普通路径的对照是 not_configured。主干两种输入都正常停止。候选主操作也已成功写回,进程与账本数量均为零。 在解析 state_file 前复用 goal_closeout_configuration 的未配置短路,与 retire 和 archive 一致。保留已配置路径的准备错误回执,再补一条禁用状态下过期别名的原生 stop 测试。
Review follow-up (
ea8fc1ebc)_project_committed_transitionturns a raisingsync_project_registry_to_globalinto aglobal_sync_failedreceipt, and_readback_committed_transitionturns a raising readback intoreadback_failed. Both run after the source commit, sowritten=true,partial_write=true, the failure reason, and the single hook dispatch all survive; the retry reconciles the projection without a second hook call.Verification on
ea8fc1ebc(rebased ontob97818e51): 135 tests acrosstest_goal_closeout_terminal_hooks.py,test_goal_closeout_hook.py,test_goal_activation.py,test_runtime_archive.py,test_global_registry_write_serialization.pyandtest_chat_machine_configuration_api.py;ruff checkclean; scopedmypyclean. New regressionstest_stop_runs_closeout_when_shared_registry_writer_raises_eioandtest_stop_runs_closeout_when_readback_raisesfail on58b164601(OSError: [Errno 5]escaping) and pass here. I also replayed the reviewer's path through the real CLI handler with a temporary File registry, a real subprocess hook, and one injectedEIO: first stop exits 1 withwritten=true,partial_write=true,global_sync.error_kind=global_sync_failed,closeout.status=success, one hook payload; the retry exits 0 withprojection_reconciled=true, nocloseoutkey, still one hook payload.Review follow-up (
58b164601)changedandwritten) instead of the combined readback. The source registry owns the transition, the shared projection is a separately reported, fixable fault, and a retry cannot re-enter the branch because the source is already stopped, so the hook runs exactly once for the committed stop. A preview or a repeated stop still runs nothing.Verification on
58b164601(rebased onto871cc3634): 133 tests acrosstest_goal_closeout_terminal_hooks.py,test_goal_closeout_hook.py,test_goal_activation.py(55),test_runtime_archive.py,test_global_registry_write_serialization.pyandtest_chat_machine_configuration_api.py;ruff checkclean; scopedmypyclean. The new regressiontest_stop_runs_closeout_for_committed_transition_when_projection_failsfails ona16896db8(KeyError: 'closeout', empty ledger) and passes here, including the retry that reconciles the projection with no second hook call.Review follow-up (
a16896db8)wrote=falsewhen hook preparation fails_retire_closeout_payloadafter the removal commits; it never raises past the receipt, resolves nothing when no command is configured, and reports a per-recordpreparation_errorwhile retirement keepsok/wrote.state_filealias_global_goal_pathtreats a value that cannot be expanded as a missing path, so an old alias no longer blocks the retirement before it commits.Verification on
a16896db8: 132 tests across closeout hook, terminal hooks, goal activation, runtime archive, global-registry serialization and machine-configuration API; Ruff clean; scoped mypy clean. Both new retire regressions fail onc9d3b3184.Closes #8918.
Goal And Delivered Outcome
goal-lifecycle stop,retire-global-goalandarchive-runtimeinvoke the configuredgoal_closeoutcommand after the terminal transition commits. The command receives one bounded JSON payload on stdin, runs with a finite timeout under the shared capped-process runtime (process-tree cleanup, bounded stdout/stderr), and the attempt is appended to a closeout ledger. A command failure, timeout or launch error never changes the triggering command's result.main.Review follow-up (
3d784d44a)commandcommandis a local-only field: the namespace merge used by/previewand/applyrejects it,project_publicreturns onlyconfiguredandtimeout_seconds, and the localmachine-configCLI keeps write access. A real HTTP request now returns 400 and writes no file.goal_idpath traversalvalidate_goal_id_path_segmentbefore reading the configuration or writing a ledger; an invalid id returnsinvalid_goal_idwith no disk change.cwd=repoheld a handle inside a worktree being archivedcwd=None.internal_errorwithledger_recorded=falselaunch_errorin the ledger and returned without raising.run_capped_process/terminate_process_tree;CappedProcessResultnow also exposes the boundedstderr.no-any-returnin the capture helpergit diff --checkblank line at EOFgoals/<id>runtime/closeout/<id>; the archive test asserts the source directory stays gone.timeout_seconds; the command stays CLI-only and the field copy says so.The executor moved from
loopx/capabilities/goal_closeout/hooks.pytoloopx/lifecycle/goal_closeout.pysoloopx/control_planedoes not depend onloopx.capabilitiesand the stop function stays under the decision-size ratchet.Review follow-up (
c9d3b3184)mypyarg-type:Mappingsnapshot passed toresolve_runtime_root_stop_closeout_payloadkeeps the transaction snapshot's concretedict[str, Any]type for both the registry and the Goal record; scopedmypy --follow-imports=silentgoes from 1 error to clean.state_filegoal_state_file_from_recordinloopx/paths.pyis the single hook-payload resolver: absolute wins; project registries keep resolving from their project root; a global registry resolves from the Goalrepo, then its own directory. Both routes call it; regressions assert the payload is the project file and reads back._archive_closeout_payload, which never raises and touches no declared path when no command is configured. Regression: stale home alias, no hook → exit 0, archive present,not_configured, no ledger.Verification on
c9d3b3184: 130 tests across closeout hook, terminal hooks, goal activation, runtime archive, global-registry serialization and machine-configuration API; Ruff clean; scoped mypy clean. The two global-path regressions and the stale-alias regression fail on260babb49.Review follow-up (
a00dd3763)archive_runtime_goalnow resolves the hook facts inside the locked snapshot and invokesrun_goal_closeoutonly after theExitStackreleases all canonical locks. The stop and retire paths already ran the hook outside their locks.test_archive_runs_closeout_after_canonical_locks_are_releasedconfigures a real probe command that tries to acquire the runtime-artifact and registry locks with a zero deadline from a child process, and asserts both are free when the hook runs. The test fails against the previous head and passes witha00dd3763.Author Declaration
Implemented against
loopx/capabilities/goal_closeout/machine_defaults.pyloopx/capabilities/machine_configuration/contract.py,loopx/capabilities/goal_closeout/machine_defaults.pyloopx/lifecycle/goal_closeout.pyloopx/lifecycle/goal_closeout.pyloopx/lifecycle/goal_closeout.pyloopx/control_plane/goals/activation_service.pyloopx/global_registry.pyloopx/runtime.pyScope And Continuation
goal-lifecycle stop,retire-global-goalandarchive-runtime; each path has an entry-point test.Validation
a00dd3763unitpassedpython3 -m pytest tests/control_plane/test_goal_activation.py tests/capabilities/test_goal_closeout_hook.py tests/capabilities/test_goal_closeout_terminal_hooks.py tests/test_runtime_archive.py tests/test_global_registry_write_serialization.py tests/extensions/test_process_runtime.py tests/extensions/test_process_runtime_startup.py -q— 173 passed, 1 skipped.real_entrypointpassedtests/capabilities/test_goal_closeout_terminal_hooks.py.real_entrypointpassedpython3 -m pytest tests/test_chat_machine_configuration_api.py tests/capabilities/test_machine_configuration_contract.py -q— 50 passed, including the real loopback HTTP command rejection.real_entrypointpassedpython3 -m pytest tests/control_plane/test_goal_activation.py -q— 55 passed; the archive lock probe intest_archive_runs_closeout_after_canonical_locks_are_releasedasserts the child process can take the runtime-artifact and registry locks while the hook runs.staticpassedpython3 -m mypy loopx/lifecycle loopx/capabilities/goal_closeout loopx/capabilities/machine_configuration/contract.py loopx/runtime.py;git diff --check;loopx canary premerge --tier quick --from-git-diffdirect checks pass (diff hygiene, compile, module ceiling).regression_paritypassedpython3 -m pytest tests/architecture -q— 1798 passed, 98 failed on both this head and the base commit; 94 failures share the missing local npm dev dependencies.staticnot_runFrontend / Visual Evidence
timeout_secondseditor field only).Type of Change
LoopX Area
Technical Direction
Shared-authority RFC fixture impact
Boundary Checklist
none.Signed-off-bytrailer.Latest revision (
10df7a231)Rebased onto
a05425b57. Both findings from review 5979637102 are fixed:_stop_closeout_payloadnow uses the registry snapshot confirmed inside the committing transaction instead of re-reading the source registry. A read that would fail after the commit can no longer turn a persisted stop intowritten=false. Any preparation failure is reported ascloseout.status = "preparation_error"while the stop keepsokandwritten.state_fileis resolved before the hook. Stop, retire and archive resolve a registered relativestate_fileagainst the registry project root; archive still points the payload at the archived copy after the move.Verification: 126 tests pass across
test_goal_closeout_terminal_hooks.py(14),test_goal_closeout_hook.py,test_goal_activation.py(55),test_runtime_archive.py,test_global_registry_write_serialization.pyandtest_chat_machine_configuration_api.py(21).ruff checkis clean on the changed files. New regressions cover a relative stop/retire registration and a registry read that only fails once the stop is committed.